<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<%@ page contentType="text/html;charset=UTF-8" language="java"  pageEncoding="UTF-8"%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>
<%@ taglib prefix="spring" uri="/WEB-INF/lib/spring.tld"%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/fmt" prefix="f" %>
<%@ taglib prefix="z" uri="/WEB-INF/lib/zerdoor.tld"%>
<c:set value="${pageContext.request.contextPath}" var="path" scope="page"/>

<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title><spring:message code='artist_list.title.msg' /></title>
    <link href="${path}/style/acg/css/style.css" rel="stylesheet" type="text/css" />
    <script src="${path}/js/jquery.min.js" type="text/javascript"></script>
    <%--<script type="text/javascript" src="${path}/style/acg/js/common.js"></script>--%>

    <link href="${path}/plugins/page/kkpager.css" rel="stylesheet">
    <script src="${path}/plugins/page/kkpager.js" type="text/javascript"></script>

    <script type="text/javascript">


        $(function(){

            f_initData();
        });


        //初始化数据
        function f_initData(){

            f_aClick(".receiver_level a","#receiver_level");
            f_aClick(".totalPositive a","#totalPositive");
            f_aClick(".totalIn a","#totalIn");
            f_aClick(".totalComplete a","#totalComplete");
            f_aClick(".totalProduction a","#totalProduction");
            //排序
            f_aClick(".listhead a","#orderBy");


            initBeanInfo(1,10,decodeURI("${keyword}"));


            $("#likeQuery").click(function(){
                initBeanInfo(1,10);
            });

        }


        /**a点击事件 传入选择器*/
        function f_aClick(selID,inputID){



            $(selID).click(function() {
                $(selID).removeClass("on");

                $(this).addClass("on");

                if(inputID != null && inputID != undefined){

                    $(inputID).val($(this).attr("value"));
                }
                initBeanInfo(1,10);

            });

        }

        var pageSize = 10;
        /**查询任务信息*/
        function initBeanInfo(page, rows,keyword) {
            /**查询任务信息*/
            pageSize = rows;


                /***设置查询数据*/
            var artist_level = $("#receiver_level").val();//艺术家等级
            var totalPositive = $("#totalPositive").val();
            var totalIn = $("#totalIn").val();
            var totalComplete = $("#totalComplete").val();
            var totalProduction = $("#totalProduction").val();
            var nickname = $("#nickname").val();

            var orderBy = $("#orderBy").val();

            if(keyword != undefined){
                nickname = keyword;
                $("#nickname").val(nickname);
            }

            var param = {rows:rows, page:page,artist_level:artist_level,totalPositive:totalPositive,totalIn:totalIn,
                totalComplete:totalComplete,totalProduction:totalProduction,nickname:nickname,orderBy:orderBy
            };



            $.ajax({
                type: "POST",
                url: "${path}/artistList/findArtistList.html",
                data: param,
                dataType: "json",
                success: function(data){
                    //console.log(data);

                    var html = "";
                    for(var i in data.list){

                        var bean = data.list[i];

                        html += "<div class='list_item'>";
                        html += "        <div class='litop'></div>";
                        html += "<div class='limain clearfix'>";
                        html += "        <div class='liimg'>";
                        html += "        <a href='${path}/artistPersonalHome/artistPersonalHome.html?receiver="+bean.artist_id+"'><img src=\"${path}/"+bean.head_portrait+"\" width='292' height='180' /></a>";
                        html += "</div>";
                        html += "<div class='licon artli'>";
                        html += "        <h2>"+bean.nickname+"</h2>";
                        html += "<div class='shuxing'>";
                        html += "        <span>"+bean.artist_level+"</span>";
                        //html += "<span>知名艺术家</span>";

                        if(bean.totalIn > 0){
                            html += "<span><spring:message code='artist_list.msg.ongoingTask' /></span>";
                        }

                        html += "</div>";
                        html += "<div class='intro'>";
                        html += bean.intro_simplify;
                        html += "</div>";
                        html += "<div class='tj'><spring:message code='artist_list.msg.totalTurnover' /><em>"+bean.totalComplete+"</em><spring:message code='artist_list.msg.single' />  &nbsp;&nbsp;&nbsp;&nbsp;";
                        html += "<spring:message code='artist_list.msg.accumulatedTurnover' /><em>"+bean.totalDealPrice+"</em><spring:message code='artist_list.msg.yuan' /></em>&nbsp;&nbsp;&nbsp;&nbsp;";
                        html += "<spring:message code='artist_list.msg.cumulativePraise' /><em>"+bean.totalPositive+"</em><spring:message code='artist_list.msg.months' />&nbsp;&nbsp;&nbsp;&nbsp;";
                        html += "<em>"+bean.totalProduction+"</em><spring:message code='artist_list.msg.oneWorks' /></div>";
                        html += "<div class='artoper'>";
                        html += "       <span><a href='${path}/usercenter/toUserMessagesHome.html?sender="+bean.user_id+"'><em class='ico_lx'></em><spring:message code='artist_list.msg.contactMe' /></a></span>";
                        html += "<span><a href='${path}/artistPersonalHome/artistPersonalHome.html?receiver="+bean.artist_id+"'><em class='ico_uba'></em><spring:message code='artist_list.msg.toHome' /></a></span>";

                        if(bean.favorite_id == ""){

                            html += "<span class='favoriteP"+bean.artist_id+"'><a href='javascript:f_favorite("+bean.artist_id+");'><em class='ico_sc'></em><spring:message code='artist_list.msg.collect' /></a></span>";
                        }else{
                            html += "<span class='favoriteP"+bean.artist_id+"'><a href='javascript:f_reFavorite("+bean.favorite_id+","+bean.artist_id+")'><em class='ico_sc'></em><spring:message code='artist_list.msg.unsubscribe' /></a></span>";
                        }

                        html += "</div>";
                        html += "</div>";
                        html += "<div class='clr'></div>";
                        html += "</div>";
                        html += "<div class='lifoot'></div>";
                        html += "</div>";


                    }


                    $("#dataDiv").html(html);

                    var pager = data;
                    //分页
                    createPage(pager.pageNum, pager.pages, pager.total);

                }
            });
        }


        //分页方法
        //currentPage 当前页
        //rows 每页条数
        //total 总数
        function createPage(currentPage, totalPage, totalCount) {
            var totalPage = totalPage;
            var totalRecords = totalCount;
            var pageNo = currentPage;
            if (!pageNo) {
                pageNo = 1;
            }
            //生成分页
            //有些参数是可选的，比如lang，若不传有默认值
            kkpager.generPageHtml({
                pno: pageNo,
                //总页码
                total: totalPage,
                //总数据条数
                totalRecords: totalRecords,
                //链接前部
                hrefFormer: 'index',
                //链接尾部
                hrefLatter: '',
                //是否显示总页数
                isShowTotalPage: true,
                //是否显示总记录数
                isShowTotalRecords: true,
                //是否显示页码跳转输入框
                isGoPage: true,
                //getLink: function (n) {
                //    return this.hrefFormer + this.hrefLatter + "?pno=" + n;
                //}
                //,
                mode : 'click',//默认值是link，可选link或者click
                click : function(n){
                    //this.selectpage(n);
                    initBeanInfo(n, pageSize);
                    return false;
                },
                lang				: {
                    firstPageText			: '<spring:message code="firstPageText"/>',
                    firstPageTipText		: '<spring:message code="firstPageTipText"/>',
                    lastPageText			: '<spring:message code="lastPageText"/>',
                    lastPageTipText			: '<spring:message code="lastPageTipText"/>',
                    prePageText				: '<spring:message code="prePageText"/>',
                    prePageTipText			: '<spring:message code="prePageTipText"/>',
                    nextPageText			: '<spring:message code="nextPageText"/>',
                    nextPageTipText			: '<spring:message code="nextPageTipText"/>',
                    totalPageBeforeText		: '<spring:message code="totalPageBeforeText"/>',
                    totalPageAfterText		: '<spring:message code="totalPageAfterText"/>',
                    totalRecordsAfterText	: '<spring:message code="totalRecordsAfterText"/>',
                    gopageBeforeText		: '<spring:message code="gopageBeforeText"/>',
                    gopageButtonOkText		: '<spring:message code="gopageButtonOkText"/>',
                    gopageAfterText			: '<spring:message code="gopageAfterText"/>',
                    buttonTipBeforeText		: '<spring:message code="buttonTipBeforeText"/>',
                    buttonTipAfterText		: '<spring:message code="buttonTipAfterText"/>'
                }
            },true);
        }

        //  收藏
        function f_favorite(artistId){

            if("${curUser.userId}" == null || "${curUser.userId}" == ""){

                alert("<spring:message code='race_info.alert.tipLogin' />");
                return;
            }

            $.post("${path}/favorite/addFavorite.html",{collectId:artistId,type:124102},function(result){

                if(result != "error"){

                    $(".favoriteP" + artistId).html("<a href='javascript:f_reFavorite("+result+","+artistId+")' class=\"sc\"><em class=\"ico_sc\"></em><spring:message code='artist_list.msg.unsubscribe' /></a>");


                }else{
                    alert("<spring:message code='artist_list.alert.favoriteFailure' />");
                }
            });
        }

        //  取消收藏
        function f_reFavorite(favoriteId,artistId){


            $.post("${path}/favorite/removeFavorite.html",{favoriteId:favoriteId,collectId:artistId,type:124102},function(result){

                if(result != "error"){

                    $(".favoriteP" + artistId).html("<a href=\"javascript:f_favorite("+artistId+");\" class=\"sc\"><em class=\"ico_sc\"></em><spring:message code='artist_list.msg.collect' /></a>");


                }else{
                    alert("<spring:message code='artist_list.alert.favoriteFailure' />");
                }
            });
        }
    </script>
</head>

<body>
<div class="header">
    <jsp:include page="../public/header.jsp">
        <jsp:param    name="home"    value="dddd"    />
    </jsp:include>
</div>

<div id="container">
    <div class="wrapper">
        <div class="wrapleft">
        	<div class="sortbox">
            	<ul>
                	<li>
                    	<dl class="clearfix receiver_level">
                        	<dt><spring:message code='artist_list.msg.membershipLevel' />：</dt>
                            <dd>
                            	<a value="" class="on"><spring:message code='artist_list.msg.all' /></a>
                                <c:forEach items="${initData.artistGrade}" var="artistGrade">
                                    <a value="${artistGrade.id}">${artistGrade.name}</a>
                                </c:forEach>


                            </dd>
                        </dl>
                        <input type="hidden" id="receiver_level">
                    </li>
                	<%--<li>--%>
                    	<%--<dl class="clearfix">--%>
                        	<%--<dt>头衔类型：</dt>--%>
                            <%--<dd>--%>
                            	<%--<a href="" class="on">全部</a>--%>
                                <%--<a href="">国内知名艺术家</a>--%>
                                <%--<a href="">美国知名艺术家</a>--%>
                            <%--</dd>--%>
                        <%--</dl>--%>
                    <%--</li>--%>
                	<li>
                    	<dl class="clearfix totalPositive">
                        	<dt><spring:message code='artist_list.msg.numberOfPraise' />：</dt>
                            <dd>
                            	<a value="" class="on"><spring:message code='artist_list.msg.all' /></a>
                                <a value="5">5<spring:message code='artist_list.msg.orMore' /></a>
                                <a value="10">10<spring:message code='artist_list.msg.orMore' /></a>
                                <a value="50">50<spring:message code='artist_list.msg.orMore' /></a>
                            </dd>
                        </dl>
                        <input type="hidden" id="totalPositive">
                    </li>
                	<li>
                    	<dl class="clearfix totalIn">
                        	<dt><spring:message code='artist_list.msg.theTask' />：</dt>
                            <dd>
                            	<a value="" class="on"><spring:message code='artist_list.msg.all' /></a>
                                <a value="1"><spring:message code='artist_list.msg.ongoing' /></a>
                                <a value="0"><spring:message code='artist_list.msg.notPerformed' /></a>
                            </dd>
                        </dl>
                        <input type="hidden" id="totalIn">
                    </li>
                    <li>
                    	<dl class="clearfix totalComplete">
                        	<dt><spring:message code='artist_list.msg.completedProject' />：</dt>
                            <dd>
                            	<a value="" class="on"><spring:message code='artist_list.msg.all' /></a>
                                <a value="1"><spring:message code='artist_list.msg.completed' /></a>
                                <a value="0"><spring:message code='artist_list.msg.unfinished' /></a>
                            </dd>
                        </dl>
                        <input type="hidden" id="totalComplete">
                    </li>
                    <li>
                    	<dl class="clearfix totalProduction">
                        	<dt><spring:message code='artist_list.msg.whetherWorks' />：</dt>
                            <dd>
                            	<a value="" class="on"><spring:message code='artist_list.msg.all' /></a>
                                <a value="1"><spring:message code='artist_list.msg.thereWorks' /></a>
                                <a value="0"><spring:message code='artist_list.msg.noWorks' /></a>
                            </dd>
                        </dl>
                        <input type="hidden" id="totalProduction">
                    </li>
            	</ul>
            </div>
            <div class="listbox">
            	<div class="listhead">
                	<ul>
                        <li><a value="is_recom" class="on"><spring:message code='artist_list.order.recommendation' /></a></li>
                        <li><a value="totalProduction desc"><spring:message code='artist_list.order.works' /></a></li>
                        <li><a value="totalComplete desc"><spring:message code='artist_list.order.frequency' /></a></li>
                        <li><a value="totalDealPrice desc"><spring:message code='artist_list.order.money' /></a></li>
                        <li><a value="totalPositive desc"><spring:message code='artist_list.order.praise' /></a></li>

                        <li> &nbsp; &nbsp; </li>
                        <li class="research">
                            <input id="orderBy" type="hidden" value="is_recom">
                            <input class="txt" id="nickname" type="text" autocomplete="off" name="key" value="" />
                            <input type="button" id="likeQuery" value="<spring:message code='artist_list.button.search' />" class="btn" />
                        </li>
                    </ul>

                </div>
                <div class="listcontainer">
                    <div class="listview clearfix" id="dataDiv">
                        <%--<div class="list_item">--%>
                            <%--<div class="litop"></div>--%>
                            <%--<div class="limain clearfix">--%>
                                <%--<div class="liimg">--%>
                                	<%--<a href=""><img src="upload/9.jpg" width="292" height="180" /></a>--%>
                                <%--</div>--%>
                                <%--<div class="licon artli">--%>
                                	<%--<h2>刘群书</h2>--%>
                                    <%--<div class="shuxing">--%>
                                        <%--<span>高级艺术家</span>--%>
                                        <%--<span>知名艺术家</span>--%>
                                        <%--<span>正在进行任务</span>--%>
                                    <%--</div>--%>
                                    <%--<div class="intro">--%>
                                        <%--任务描述文字任务描述文字任务描述文字，任务描述文字任务描述文字，任务描述文字，任务描述文字任务描述文字任务描述文字任务描述文字。--%>
                                    <%--</div>--%>
                                    <%--<div class="tj">月成交<em>62</em>单  &nbsp;&nbsp;&nbsp;&nbsp;累计成交<em>56,000</em>元</em>&nbsp;&nbsp;&nbsp;&nbsp;累计好评<em>6</em>个&nbsp;&nbsp;&nbsp;&nbsp;<em>35</em>个作品</div>--%>
									<%--<div class="artoper">--%>
                                        <%--<span><a href=""><em class="ico_lx"></em>联系我</a></span>--%>
                                        <%--<span><a href=""><em class="ico_uba"></em>进入主页</a></span>--%>
                                        <%--<span><a href=""><em class="ico_sc"></em>收藏</a></span>--%>
                                    <%--</div>--%>
                        		<%--</div>--%>
                                <%--<div class="clr"></div>--%>
                            <%--</div>--%>
                            <%--<div class="lifoot"></div>--%>
                        <%--</div>--%>
                        <div class="clr"></div>
                    </div>
                    <div class="pagebox">
                        <div id="kkpager" style="text-align: center"></div>
                    </div>
                </div>
            </div>
        </div>
        <div class="wrapright">
        	<div class="artapply">
            	<h2><a href="${path}/usercenter/index.html"><spring:message code='artist_list.msg.artist' /></a></h2>
                <p>
                   <spring:message code='artist_list.msg.taskMsg' />
                </p>
            </div>
            <%--<div class="clientdown"><a href=""><img src="${path}/style/acg/images/clientdown.jpg" width="330" height="160" /></a></div>--%>
        	<%--<div class="eliteart">--%>
            	<%--<div class="elitetit">热门艺术家排名</div>--%>
                <%--<div class="elitelist">--%>
                	<%--<ul class="clearfix">--%>
                        <%--<li>--%>
                            <%--<a href=""><img src="upload/12.jpg" width="292" height="180" /></a>--%>
                      <%--<div class="txt">--%>
                                <%--<h3><span>金牌插画师</span>刘云杰</h3>--%>
                                <%--<p>已受268893人好评<span  class="more"><a href="">了解详情</a></span></p>--%>
                            <%--</div>--%>
                        <%--</li>--%>
                        <%--<li>--%>
                            <%--<a href=""><img src="upload/9.jpg" width="292" height="180" /></a>--%>
                          <%--<div class="txt">--%>
                                <%--<h3><span>金牌插画师</span>刘云杰</h3>--%>
                                <%--<p>已受268893人好评<span  class="more"><a href="">了解详情</a></span></p>--%>
                            <%--</div>--%>
                        <%--</li>--%>
                        <%--<li>--%>
                            <%--<a href=""><img src="upload/10.jpg" width="292" height="180" /></a>--%>
                          <%--<div class="txt">--%>
                                <%--<h3><span>金牌插画师</span>刘云杰</h3>--%>
                                <%--<p>已受268893人好评<span  class="more"><a href="">了解详情</a></span></p>--%>
                            <%--</div>--%>
                        <%--</li>--%>
                        <%--<li>--%>
                            <%--<a href=""><img src="upload/11.jpg" width="292" height="180" /></a>--%>
                      <%--<div class="txt">--%>
                                <%--<h3><span>金牌插画师</span>刘云杰</h3>--%>
                                <%--<p>已受268893人好评<span  class="more"><a href="">了解详情</a></span></p>--%>
                            <%--</div>--%>
                        <%--</li>--%>
                        <%--<li>--%>
                            <%--<a href=""><img src="upload/9.jpg" width="292" height="180" /></a>--%>
<%--<div class="txt">--%>
                                <%--<h3><span>金牌插画师</span>刘云杰</h3>--%>
                                <%--<p>已受268893人好评<span  class="more"><a href="">了解详情</a></span></p>--%>
                            <%--</div>--%>
                      <%--</li>--%>
                    <%--</ul>--%>
                <%--</div>--%>
            <%--</div>--%>
        </div>
        <div class="clr"></div>
    </div>
</div>
<div id="footer">
    <!--content-->
    <jsp:include page="../public/footer.jsp"></jsp:include>
</div>

</body>
</html>
